
<template>
  <ex_select_auto ref="main" :option="{ label: 'labelStr', value: 'id' }" storeData
    :placeholder="$tt('tip_please_select_warehouse_area')" url="/wms-api/base/WmsBaseAreaRpc/selectAllLabel.json"
    :value="value" :urlParams="{ warehouseId, }"
    @focus="() => warehouseId ? null : $message.warning($tt('tip_please_select_warehouse_first'))"
    :urlControl="urlControlFun" v-bind="$attrs" v-on="$listeners" />
</template>

<script>

export default {
  name: 'base_area_select',
  props: {
    value: null,

    warehouseId: {
      type: [String,],
    },
  },
  watch: {
    warehouseId: function (newVal, oldVal) {
      this.$nextTick(() => {
        const config = {}
        if (oldVal) {
          config.initValue = null
        }
        this.$refs.main.reloadData(config)
      })


    },
  },
  methods: {
    urlControlFun(params) {
      if (params.warehouseId) {
        return true
      } else {
        return {
          netStop: true,
          focusInnerData: [],
        }
      }
    },
  },
}
</script>
